function UrlSearch() 
{
   var name,value; 
   var str=location.href; //取得整个地址栏
   var num=str.indexOf("?") 
   str=str.substr(num+1); //取得所有参数   stringvar.substr(start [, length ]
 
   var arr=str.split("&"); //各个参数放到数组里
   for(var i=0;i < arr.length;i++){ 
    num=arr[i].indexOf("="); 
    if(num>0){ 
     name=arr[i].substring(0,num);
     value=arr[i].substr(num+1);
     this[name]=value;
     } 
    } 
}

function formatDateTime(inputTime) {    
    var date = new Date(inputTime);  
    var y = date.getFullYear();    
    var m = date.getMonth() + 1;    
    m = m < 10 ? ('0' + m) : m;    
    var d = date.getDate();    
    d = d < 10 ? ('0' + d) : d;    
    var h = date.getHours();  
    h = h < 10 ? ('0' + h) : h;  
    var minute = date.getMinutes();  
    var second = date.getSeconds();  
    minute = minute < 10 ? ('0' + minute) : minute;    
    second = second < 10 ? ('0' + second) : second;
    return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;    
}

function formatDate(inputTime) {    
    var date = new Date(inputTime);  
    var y = date.getFullYear();    
    var m = date.getMonth() + 1;    
    m = m < 10 ? ('0' + m) : m;    
    var d = date.getDate();    
    d = d < 10 ? ('0' + d) : d;    
    var h = date.getHours();  
    h = h < 10 ? ('0' + h) : h;  
    var minute = date.getMinutes();  
    var second = date.getSeconds();  
    minute = minute < 10 ? ('0' + minute) : minute;    
    second = second < 10 ? ('0' + second) : second;
    return y + '-' + m + '-' + d;    
}

function leftTimer(date,targeID){
	  var leftTime = date - (new Date()); // 计算剩余的毫秒数
	  var days = parseInt(leftTime / 1000 / 60 / 60 / 24 , 10); // 计算剩余的天数
	  var hours = parseInt(leftTime / 1000 / 60 / 60 % 24 , 10); // 计算剩余的小时
	  var minutes = parseInt(leftTime / 1000 / 60 % 60, 10);// 计算剩余的分钟
	  var seconds = parseInt(leftTime / 1000 % 60, 10);// 计算剩余的秒数
	  days = checkTime(days); 
	  hours = checkTime(hours); 
	  minutes = checkTime(minutes); 
	  seconds = checkTime(seconds); 
	  //$("#"+targeID).text(days+"天" + hours+"小时" + minutes+"分"+seconds+"秒");
	  if(hours=="00"&&minutes=="00"&&seconds=="00"){
		  clearTimeout(arrivalTimeTimer1);
		  $("#"+targeID).text("已过期");
	  }
	  $("#"+targeID).text(hours+"小时" + minutes+"分"+seconds+"秒");
} 
function checkTime(i){ // 将0-9的数字前面加上0，例1变为01
  if(i<10) 
  { 
    i = "0" + i; 
  } 
  return i; 
} 

function getItemNameByCode(key){
	if("J"==key){
		return "剪发";
	}else if("T"==key){
		return "烫发";
	}else if("R"==key){
		return "染发";
	}else if("X"==key){
		return "洗头";
	}
}